import request from '../request'
import type { UserInfoType, RoleTypeListType, IUserWareHouseInfo, IRouterType } from '@/types/modules/login'

enum loginApiEnum {
  accountSignIn = 'auth/user/account/signIn',
  accountDetail = 'auth/user/account/detail',
  commonRoleTypeList = 'auth/common/roleType/list',
  userColumnDataInfo = 'auth/user/column/dataInfo',
  menuPermissions = 'auth/user/menu/permissions',
}

/**登录 */
export const accountSignIn = (data: any) => request.POST<{ token: string }>({ url: loginApiEnum.accountSignIn, data })

/**用户详情 */
export const accountDetail = () => request.GET<UserInfoType>({ url: loginApiEnum.accountDetail })

/**当前系统所有角色类型 */
export const commonRoleTypeList = (data: any) => request.GET<RoleTypeListType[]>({ url: loginApiEnum.commonRoleTypeList, data })

/**根据角色类型获取仓库下拉 */
export const userColumnDataInfo = (data?: any) => request.POST<IUserWareHouseInfo>({ url: loginApiEnum.userColumnDataInfo, data })

/**根据（角色类型）获取用户菜单权限数据信息 */
export const menuPermissions = (data: any) => request.POST<{ menuList: IRouterType[] }>({ url: loginApiEnum.menuPermissions, data })
